<?php 

if (!defined('_JEXEC')) die('Restricted access');


?>



<h2>wbDatabase - Overview</h2>

<form action="index.php?option=com_wbdatabase" method="post" name="adminForm">
  <table>
    <tr>
      <td align="left" width="100%">
        <?php echo JText::_( 'Filter' ); ?>:
        <input type="text" name="search" id="search" value="<?php echo $this->lists['search'];?>" class="text_area" onchange="document.adminForm.submit();" />
        <?php echo JText::_('ShowCode');?>:   
        <input type="checkbox" name="showcode" id="showcode" <?php if ($this->showcode === true) echo ("checked=\"checked\"")?>  />
        <button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
        <button onclick="document.getElementById('search').value='';document.getElementById('showcode').checked='';this.form.getElementById('filter_state').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
      </td>
    </tr>
  </table>
  <div id="editcell">
    <table class="adminlist">
      <thead>
        <tr>
          <th>
            <?php echo JText::_( 'NUM' ); ?>
          </th>        
          <th>
          </th>
          <th>
            <?php echo JHTML::_('grid.sort',   'Title', 'm.title', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
          </th>
          <th <?php if (!$this->showcode) echo 'class="codeclass"';?> >
            <?php echo JHTML::_('grid.sort',   'Code', 'm.code', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
          </th>
          <th>
            <?php echo JHTML::_('grid.sort',   'User', 'm.user', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
          </th>
          <th>
            <?php echo JHTML::_('grid.sort',   'Email', 'm.email', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
          </th>
          <th>
            <?php echo JHTML::_('grid.sort',   'Url', 'm.url', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
          </th>
          <th>
            <?php echo JHTML::_('grid.sort',   'Comment', 'm.comment', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
          </th>
          <th>
            <?php echo JHTML::_('grid.sort',   'Tags', 'm.tags', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
          </th>

        </tr>
      </thead>
      <tfoot>
        <tr>
          <td colspan="9">
            <?php echo $this->pagination->getListFooter(); ?>
          </td>
        </tr>
      </tfoot>
      <?php
      define('lf', "\n");
      
      $evenodd = 0;
      for ($i = 0, $n = count($this->items); $i < $n; $i += 1)
      {
        $row = $this->items[$i];
        $link = JRoute::_( 'index.php?option=com_wbdatabase&controller=wbdatabase&task=edit&cid[]='. $row->id );
        //$checked  = JHTML::_('grid.checkedout',   $row, $i );
        $checked    = JHTML::_( 'grid.id', $i, $row->id );
        //$published  = JHTML::_('grid.published', $row, $i );
        
        
        $url = $row->url;
        if ($url !== '')
        {
          if ((strpos($url, 'http://') !== 0) and
             (strpos($url, 'file://') !== 0) and
             (strpos($url, 'svn://') !== 0) and
             (strpos($url, 'ftp://') !== 0)
             )
          {
            $url = "http://$url";
          }
          $url = "<a href=\"$url\" target=\"_blank\">$row->url</a>";
        }
        
        $rowindex = $this->pagination->getRowOffset( $i );
        $editTitle = JText::_( 'Edit Record' );
        $code = $this->showcode ? $row->code : '****';
        $rcode = htmlspecialchars($row->code);
        $ruser = htmlspecialchars($row->user);
        $remail = htmlspecialchars($row->email);
        $rurl = htmlspecialchars($row->url);
        $rcomment = htmlspecialchars($row->comment);
        $rtags = htmlspecialchars($row->tags);
        
        echo "<tr class=\"row$evenodd\">"; 
        echo "<td>$rowindex</td>";     
        echo "<td>$checked</td>";
        echo "<td>";
        echo "<span class=\"editlinktip hasTip\" title=\"$editTitle::$row->title\">";
        echo "<a href=\"$link\">";
        echo "$row->title";
        echo "</a>";
        echo "</span>";
        echo "</td>";
        echo "<td title=\"$rcode\">$code</td>";
        echo "<td title=\"$ruser\">$row->user</td>";
        echo "<td title=\"$remail\"><a href=\"mailto://$row->email\">$row->email</a></td>";
        echo "<td title=\"$rurl\">$url</td>";
        echo "<td title=\"$rcomment\">$row->comment</td>";
        echo "<td title=\"$rtags\">$row->tags</td>";
        echo '</tr>'.lf;
        $evenodd = 1 - $evenodd;
      }
      ?>
    </table>
  </div>
  
  <input type="hidden" name="option" value="com_wbdatabase" />
  <input type="hidden" name="view" value="overzicht" />
  <input type="hidden" name="task" value="" />
  <input type="hidden" name="boxchecked" value="0" />
  <input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
  <input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
  <?php echo JHTML::_( 'form.token' ); ?>
  
</form>




